
#include "trimmer.h"

#include <iostream>
#include <string>


using namespace std;

int main(){


  cout << "\n\t\t example to test the trimmer class.";
  cout << "\n\ttrimmer class strips spaces in FRONT or BACK or BOTH sides of a string.\n\n";
  cout << "\n\t\t\t ---------------\n\n";

  trimmer f;
  string a="\t   <-tab spaces->   ";

  cout << "\n\t --->  string: \"" << a << "\"";

  trimmer::stripMode direction = trimmer::FRONT;

  cout << "\n\n\t status *before* trimming:";
  cout << "\n\t\t existStatus (enum): " << f.getStatus() << "  - 0 is UNDEFINED.\n";

  cout << "\n\t ---> FRONT: \"" << f.trim( a, direction ) << "\"";
  cout << "\n\t --->  BACK: \"" << f.trim( a, trimmer::BACK) << "\" BEWARE: the front of this string does not look like the original, since the tab is adapting!";
  cout << "\n\t\t we should compare the before and the after string like this:";
  cout << "\n\t\t before:";
  cout << "\n\t\t\""<<a<<"\"";
  cout << "\n\n\t\t after:";
  cout << "\n\t\t\""<<f.trim( a, trimmer::BACK)<<"\"";
  cout << "\n\t\t now the trimmer is behaving like one would naivly expects.";
  cout << "\n\t --->  BOTH: \"" << f.trim( a, trimmer::BOTH) << "\"";
  cout << "\n\t ---> original string: \"" << a << "\"";

  cout << "\n\n\n\t status *after* trimming in BOTH direction:";
  cout << "\n\t\t existStatus (enum): " << f.getStatus() << "  - 5 is BOTH_DIRECTION.";
  cout << "\n\n\t read trimmer.h file to see all possible existStatus values.\n\n";

  cout << "\n\t trimming an empty string:";
  cout << "\n\t ---> before: \"\"\t after: \"" << f.trim( "", trimmer::FRONT ) << "\"";
  cout << "\n\t\t existStatus (enum): " << f.getStatus() << "  - 1 is EMPTY_INPUT.\n";

  cout << "\n\t nothing to be trimmed (using FRONT):";
  cout << "\n\t ---> before: \"XXX\"\t after: \"" << f.trim( "XXX", trimmer::FRONT ) << "\"";
  cout << "\n\t\t existStatus (enum): " << f.getStatus() << "  - 3 is FRONT_DIRECTION\n";

  cout << "\n\t trimming a space-only string (using FRONT):";
  cout << "\n\t ---> before: \"   \"\t after: \"" << f.trim( "   ", trimmer::FRONT ) << "\"";
/*
  cout << "\n\n\t select words before \"#\" and after \"g X w\":";
  cout << "\n\t ---> string concatenation: \"" << f.strip( a, "#", stripper::FRONT ) + f.strip(a, "g X w", stripper::BACK ) << "\"";
*/

  cout << endl << endl;

  return 0;
}

